package com.xyd.Servlet;

import com.xyd.Biz.FatherOrderBiz;
import com.xyd.Biz.Impl.FatherOrderBizImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/html/manage/UpdateFatherOrderListForStateServlet")
public class UpdateFatherOrderListForStateServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        long orderId = Long.parseLong(request.getParameter("fatherOrderId"));
        int fatherOrderState = Integer.parseInt(request.getParameter("state"));

        FatherOrderBiz fatherOrderBiz = new FatherOrderBizImpl();
        int flag = fatherOrderBiz.updateFatherOrderState(fatherOrderState,orderId);
        PrintWriter out = response.getWriter();

        if (flag>=1){
            out.write("true");
        }else {
            out.write("false");
        }

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

}
